﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Authority.Client
{
    public class UserAuthority
    {
        /// <summary>
        /// 获取角色菜单
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="sysCode"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool GetAuthorityMenuListByUserId(int userId,string sysCode,string authorityUrl,out string msg)
        {
            Encoding apiEncoding = Encoding.UTF8;
            string url = string.Format("{0}/Authority/GetAuthorityMenuList?userId={1}&systemCode={2}", authorityUrl, userId, sysCode);
            msg = "";
            return RequestHelper.GetHtml(url, "get", apiEncoding, out msg, 2000);
        }

        /// <summary>
        /// 验证用户页面权限
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="menuCode"></param>
        /// <param name="sysCode"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool CheckUserPageAuthority(int userId,string menuCode, string sysCode,string authorityUrl, out string msg)
        {
            Encoding apiEncoding = Encoding.UTF8;
            string url = string.Format("{0}/Authority/VerificationUserAuthority?userId={1}&menuCode={2}&systemCode={3}", authorityUrl, userId, menuCode, sysCode);
            msg = "";
            return RequestHelper.GetHtml(url, "get", apiEncoding, out msg, 2000);
        }
    }
}
